package org.kleathome.dcpu16;

public class DCPU16Div extends DCPU16Instruction
{
	@Override
	public String parseInstruction(String in)
	{
		return super.parseInstruction(in.substring(4).trim());
	}
	
	@Override
	public int getCycleCost()
	{
		return 3 + super.getCycleCost();
	}
	
	@Override
	public int getOpCode()
	{
		return 0x05;
	}
	
	@Override
	public void execute()
	{
		char vA = valueA.getValue();
		char vB = valueB.getValue();
		valueA.setValue((char)(vA / vB));
	}

	@Override
	public String getOpCodeLiteral()
	{
		return "DIV";
	}

	@Override
	public DCPU16Instruction getNewObject()
	{
		return new DCPU16Div();
	}
}
